﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Rose.Models.RegisterModel>" %>

<h2>创建新帐户</h2>
   
    <p>
       <%=ViewData["Message"] %>
      
    </p>
    <p> <%=ViewData["Error"] %></p>

   
        <div>
          <form method="post" action="<%=Url.Action("Register","Account") %>">
           <p><label>邮箱账号</label><%=Html.TextBoxFor(m=>m.UserName) %></p>
           <p><label>密码</label><%=Html.PasswordFor(m=>m.Password) %></p>
           <p><label>确认密码</label><%=Html.PasswordFor(m=>m.ConfirmPassword) %></p>
           <p><label>保密问题</label><%=Html.TextBoxFor(m=>m.SecretQuestion) %></p>
           <p><label>保密答案</label><%=Html.TextBoxFor(m=>m.SecretAnswer) %></p>
           <p><label>真实姓名</label><%=Html.TextBoxFor(m=>m.TrueName) %></p>
           <p><label>性别</label><%=Html.DropDownList("Gender") %></p>
         
           <p><label>大学</label><%=Html.TextBoxFor(m=>m.University) %></p>
           <p><label>专业</label><%=Html.TextBoxFor(m=>m.Major) %></p>
           <p><label>入学年份</label><%=Html.TextBoxFor(m=>m.SchoolYear) %></p>
           <p><label>验证码</label><%=Html.TextBoxFor(m=>m.Captcha) %><a><img id="captcha" src="/Account/GetCaptcha?random=1" /></a><a id="changecaptcha">看不清楚？换一张</a></p>

           <% string retUrl;
              if (!String.IsNullOrEmpty(Request.QueryString["returnUrl"]))
                  retUrl = Request.QueryString["returnUrl"];
              else if (!string.IsNullOrEmpty(Request.QueryString["ReturnUrl"]))
                  retUrl = Request.QueryString["ReturnUrl"];
                  
              else if (Request.UrlReferrer != null)
              {
                  if (Request.UrlReferrer.ToString().Contains("ReturnUrl="))
                  {
                      int index = Request.UrlReferrer.ToString().IndexOf("ReturnUrl=");
                      retUrl = Request.UrlReferrer.ToString().Substring(index+"ReturnUrl=".Length);
                  }
                  else
                      retUrl = Request.UrlReferrer.ToString();
              }
                  
              else retUrl = String.Empty;
               %>
           
           
            <input type="hidden" name="ReturnUrl" value="<%=retUrl %>" />
                

                <p>
          <input type="submit" value="注册" />
                </p>
          </form>
         
        </div>
   
    <script type="text/javascript">
        $(document).ready(function () {
            $('#changecaptcha').click(function () {
                document.getElementById('captcha').src = "/Account/GetCaptcha?random=" + Math.random();

            })
        });
        </script>